Fix #151: Allow mixed comma and whitespace separation in transform pa…#152
Fix #151: Allow mixed comma and whitespace separation in transform pa…#152shiinapple wants to merge 4 commits intoweisJ:masterfrom
Conversation
| ListSplitter.SplitResult result = splitter.testChar(c, i - start); | ||
| if (result.shouldSplit()) { | ||
| list.add(value.substring(start, i)); | ||
| if (i - start > 0) list.add(value.substring(start, i)); |
There was a problem hiding this comment.
I think this might allow 1,,1 to be parsed as a list of only two strings, while it should really contain the empty string. Can we instead make sure to only avoid splitting while we are seeing whitespace directly after encountering a non whitespace delimiter?
|
Thanks for the review! I’ve reconsidered the splitting rules for transforms and reworked the implementation accordingly. Changes
|
|
Looking better now. I just pushed some tests which I would like the |
|
Thank you for your patience in providing test cases! Changes:
Validation:
|
|
I don't think this should depend in the splitter being a |
Modified ParserUtil.java to add a guard
if (i - start > 0)before adding tokens to the list. This ensures that consecutive separators (e.g., "-1 , 1") do not produce empty strings, which previously caused parsing failures.Added two tests in AttributeParserTest.java:
Both tests now pass correctly.
This is my first pr. Please let me know if anything needs to be adjusted!